<?php
session_start();

require_once("../database.include.php");

	$username=$_GET["username"];
	$groupname=$_GET["groupname"];
	
	/* Delete all rows from the group_user table */
	$sql = "DELETE FROM `group_user` WHERE `group_name` = '" . $groupname . "' AND `user_name` = '" . $username . "'";
	echo $sql . "<br>";
	$count = $conn->exec($sql);
	/* Return number of rows that were deleted */
	echo "Deleted $count rows in group_user.\n";


	/* Delete all rows from the group_invitation table */
	$sql = "DELETE FROM `group_invitation` WHERE `group_name` = '" . $groupname . "' AND `inviting_user_name` = '" . $username . "'";
	echo $sql . "<br>";
	$count = $conn->exec($sql);
	/* Return number of rows that were deleted */
	echo "Deleted $count rows in group_invitation.\n";

?>